/**
 * 图片懒加载
 */
import { useIntersectionObserver } from '@vueuse/core'

function mounted(el) {
  const src = el.src
  el.src = ''
  const { stop } = useIntersectionObserver(el, ([{ isIntersecting }]) => {
    if (isIntersecting) {
      el.src = src
      stop()
    }
  })
}

export default {
  mounted
}
